/** @file               sw_tbuf.h
 *  @copyright          Copyright (C) 2006-2026 flyfish (tenggui_fu@126.com)
 *  @brief              This file is part of the swallow library
 *  @author             $Author: flyfish $
 *  @version            $Rev: 385 $
 *  @date               $Date: 2016-12-22 00:12:05 +0800 (周四, 22 12月 2016) $
 */
#ifndef __SW_TBUF_H__
#define __SW_TBUF_H__

#ifdef __cplusplus
extern "C" {
#endif

typedef SW_VOID *SW_TBUF;
#define SW_INVALID_TBUF NULL

SW_API SW_RET SW_InitTbufAPI(SW_VOID);
SW_API SW_RET SW_RunTbufAPI(SW_VOID);
SW_API SW_RET SW_StopTbufAPI(SW_VOID);
SW_API SW_RET SW_ExitTbufAPI(SW_VOID);
SW_API SW_TBUF SW_CreateTbuf(SW_UINT32 itemSize, SW_UINT32 itemMax);
SW_API SW_RET SW_DeleteTbuf(SW_TBUF tbuf);
SW_API SW_RET SW_ClearTbufEmpty(SW_TBUF tbuf);
SW_API SW_RET SW_ClearTbufFull(SW_TBUF tbuf);
SW_API SW_RET SW_ReadTbufEmpty(SW_TBUF tbuf, SW_VOID *pItem);
SW_API SW_RET SW_ReadTbufFull(SW_TBUF tbuf, SW_VOID *pItem);
SW_API SW_RET SW_TryReadTbufEmpty(SW_TBUF tbuf, SW_VOID *pItem);
SW_API SW_RET SW_TryReadTbufFull(SW_TBUF tbuf, SW_VOID *pItem);
SW_API SW_RET SW_TimeReadTbufEmpty(SW_TBUF tbuf, SW_VOID *pItem, SW_UINT32 msec);
SW_API SW_RET SW_TimeReadTbufFull(SW_TBUF tbuf, SW_VOID *pItem, SW_UINT32 msec);
SW_API SW_RET SW_WriteTbufEmpty(SW_TBUF tbuf, const SW_VOID *pItem);
SW_API SW_RET SW_WriteTbufFull(SW_TBUF tbuf, const SW_VOID *pItem);
SW_API SW_RET SW_TryWriteTbufEmpty(SW_TBUF tbuf, const SW_VOID *pItem);
SW_API SW_RET SW_TryWriteTbufFull(SW_TBUF tbuf, const SW_VOID *pItem);
SW_API SW_RET SW_TimeWriteTbufEmpty(SW_TBUF tbuf, const SW_VOID *pItem, SW_UINT32 msec);
SW_API SW_RET SW_TimeWriteTbufFull(SW_TBUF tbuf, const SW_VOID *pItem, SW_UINT32 msec);
SW_API SW_RET SW_SwitchTbufFull(SW_TBUF tbuf, const SW_VOID *pFullItem, SW_VOID *pEmptyItem);
SW_API SW_RET SW_SwitchTbufEmpty(SW_TBUF tbuf, const SW_VOID *pEmptyItem, SW_VOID *pFullItem);
SW_API SW_UINT32 SW_GetTbufEmptyItemCount(SW_TBUF tbuf);
SW_API SW_UINT32 SW_GetTbufFullItemCount(SW_TBUF tbuf);

#ifdef __cplusplus
}
#endif

#endif

